package geno.app.junit;


import static org.junit.Assert.assertTrue;
import geno.app.MySquare;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

public class SquareTest {

	MySquare s;
	
	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
	}

	@AfterClass
	public static void tearDownAfterClass() throws Exception {
	}

	@Before
	public void setUp() throws Exception {
	}

	@After
	public void tearDown() throws Exception {
	}

	
	@Test
	public void test1() {
		// all values should be 0
		// After area reader is written.
		s = new MySquare();
		try
		{
			assertTrue("Test 1: Default values are wrong.", 
				 s.getWidth()==0 && s.getArea()==0);
			System.out.println("Object Oriented Approach Test 1 completed successfully.");
		}
		catch (AssertionError e)
		{
			System.out.println(e.getMessage());
		}
	}
	
	@Test
	public void test2()
	{
		// After second constructor is written.
		s = new MySquare();
		try
		{
			s = new MySquare(10);
			assertTrue("Test 2: Initial values are wrong.", 
				s.getWidth() ==10 && s.getArea()==100);
			System.out.println("Object Oriented Approach Test 2 completed successfully.");
		}
		catch (AssertionError e)
		{
			System.out.println(e.getMessage());
		}
	}
}
